using System;
using System.Collections.Generic;
using System.Text;
using System.Web;

namespace Chat
{
	public class Request : IHttpHandler
	{
		private HttpContext _context;

		#region IHttpHandler Members

		/// <summary>
		/// Gets a value indicating whether another request can use the <see cref="T:System.Web.IHttpHandler"></see> instance.
		/// </summary>
		/// <value></value>
		/// <returns>true if the <see cref="T:System.Web.IHttpHandler"></see> instance is reusable; otherwise, false.</returns>
		public bool IsReusable
		{
			get { return false; }
		}

		/// <summary>
		/// Gets the context.
		/// </summary>
		/// <value>The context.</value>
		protected HttpContext Context
		{
			get
			{
				return _context;
			}
		}

		/// <summary>
		/// Enables processing of HTTP Web requests by a custom HttpHandler that implements the <see cref="T:System.Web.IHttpHandler"></see> interface.
		/// </summary>
		/// <param name="context">An <see cref="T:System.Web.HttpContext"></see> object that provides references to the intrinsic server objects (for example, Request, Response, Session, and Server) used to service HTTP requests.</param>
		public void ProcessRequest(HttpContext context)
		{
			if (context == null)
				throw new ArgumentNullException("context");

			if (context.Response == null)
				throw new ArgumentNullException("context.Response");

			_context = context;

			context.Response.ContentType = "text/xml";
			context.Response.Write(DateTime.Now.ToString() + " Test!");

			context.Response.Flush();

			context.Response.Write(DateTime.Now.ToString() + " Test!");

			context.Response.Flush();
		}

		#endregion
	}
}
